package kr.hyunist.androidcomplete01saeildamil.ch08;

import kr.hyunist.androidcomplete01saeildamil.*;
import android.app.*;
import android.os.*;
import android.view.*;
import android.view.View.OnClickListener;
import android.widget.*;

public class ImageDrawableEx extends Activity {
	ImageView iv;
	Button btn1;
	Button btn2;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.imagesdrawableex);

		iv = (ImageView) findViewById(R.id.drawableimg1);
		btn1 = (Button) findViewById(R.id.drawablebtn1);
		btn2 = (Button) findViewById(R.id.drawablebtn2);

		btn1.setOnClickListener(mOnClickListener);
		btn2.setOnClickListener(mOnClickListener);
	}

	OnClickListener mOnClickListener = new OnClickListener() {

		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.drawablebtn1:
				iv.setImageResource(R.drawable.dream02);
				break;
				
			case R.id.drawablebtn2:
				iv.setImageResource(R.drawable.dream01);
				break;
			}
		}

	};
}
